/** 管理路由 */
import Layout from '@/views/layout/settingLayout'


/**
 * 系统管理里的 客户管理
 */
const systemCustomerRouter = {
	path: 'system-customer',
	meta: {
		title: '客户管理',
		icon: 'customer',
		requiresAuth: true,
		index: 1,
		type: 'setting',
		subType: 'bizparam'
	},
	children: [
		{
			path: 'bizparam',
			component: () => import('@/views/setting/customer/bizparam'),
			meta: {
				title: '业务参数设置',
				requiresAuth: true,
				index: 1,
				type: 'setting',
				subType: 'bizparam'
			}
		}
		
	]
}


/**
 * 不包含children的路由
 */

const systemEmployeeRouter = {
	path: '/setting',
	component: Layout,
	redirect: '/setting/index',
	name: 'manager',
	meta: {
		requiresAuth: true,
		title: '系统管理',
		index: 0,
		type: 'setting'
	},
	children: [
		{
			path: 'index', 
			component: () => import('@/views/setting/index/system'),
			meta: {
				requiresAuth: true,
				title: '系统首页',
				icon: 'product',
				index: 1,
				type: 'setting',
				subType: 'index'
			}
		},
		{
			path: 'groupindex',
			component: () => import('@/views/setting/auth/manage'),
			meta: {
				requiresAuth: true,
				title: '权限管理',
				icon: 'employeestatistics',
				index: 1,
				type: 'setting',
				subType: 'groupindex'
			}
		},
		{
			path: 'userindex',
			component: () => import('@/views/setting/user/account'),
			meta: {
				requiresAuth: true,
				title: '账号管理',
				icon: 'user',
				index: 1,
				type: 'setting',
				subType: 'userindex'
			}
		},
		{
			path: 'loginlog',
			component: () => import('@/views/setting/user/loginlog'),
			meta: {
				requiresAuth: true,
				title: '登录日志',
				icon: 'workbench',
				index: 1,
				type: 'setting',
				subType: 'loginlog'
			}
		}
	]
}

const handlefieldRouter = {
	name: 'handlefield',
	path: 'custom-field/handlefield/:type/:id', // type customer contacts business contract money
	component: () => import('@/views/setting/field/HandleField'),
	meta: {
		changeMenu: false, // 跳转不更改路径
		menuSelct: 'system-customer',
		menuIndex: 'custom-field'
	},
	hidden: true
}




// export default settingRouter

export const settingRouter = {
	path: '/setting',
	component: Layout,
	redirect: '/setting/index',
	name: 'setting',
	hidden: true,
	meta: {
		requiresAuth: true,
		title: '系统管理',
		index: 0,
		type: 'setting'
	},
	children: [
		...systemEmployeeRouter.children,
		...systemCustomerRouter.children,
		handlefieldRouter
	]
}

export const managerRouterMenu = [
	...systemEmployeeRouter.children,
	systemCustomerRouter
]